<?php
class Model {
	public $db;//数据库驱动对象
	public $table=null;//操作表名
	public $error=null;//错误信息
	//构造函数
	public function __construct($table=null){
		$this->db = DbFactory::getDriver();
		$this->db->table =$this->table?$this->table:$table;
	}
	//插入数据
	public function insert($data){
		return $this->db->insert($data);
	}
	//条件 
	public function where($where){
		$this->db->where($where);
		return $this;
	}
	//查询
	public function select(){
		return $this->db->select();
	}
	//Limit
	public function limit($limit){
		$this->db->limit($limit);
		return $this;
	}
	//修改
	public function update($data){
		return $this->db->update($data);
	}
	//删除
	public function delete(){
		return $this->db->delete();
	}

}